package ac.zlf.springmybatis.core.mybatis.dialect;

import ac.zlf.springmybatis.core.mybatis.domain.PageRequest;

import org.apache.ibatis.mapping.MappedStatement;

public class H2Dialect extends Dialect {
    public H2Dialect(MappedStatement mappedStatement, Object parameterObject, PageRequest pageRequest) {
        super(mappedStatement, parameterObject, pageRequest);
    }

    protected String getLimitString(String sql, String offsetName, int offset, String limitName, int limit) {
        return sql.length() + 40 + sql + (offset > 0 ? " limit " + String.valueOf(limit) + " offset " + String.valueOf(offset) : new StringBuilder().append(" limit ").append(String.valueOf(limit)).toString());
    }
}